/**
 * Bestpay.com.cn Inc.
 * Copyright (c) 2011-2020 All Rights Reserved.
 */
package com.suxiaoxiao.springbootlearn.designpattern.statepattern.goodcode.rmi.client;

import com.suxiaoxiao.springbootlearn.designpattern.statepattern.goodcode.rmi.server.GumballMachineRemote;

import java.rmi.RemoteException;

/**
 * 糖果机监控器
 *
 * @author zhaorongzhang
 * @version GumballMonitor.java, v 0.1 2020/1/11 6:29 下午 zhaorongzhang Exp $$
 */
public class GumballMonitor {

    GumballMachineRemote machine;

    public GumballMonitor(GumballMachineRemote machine) {
        this.machine = machine;
    }

    public void report() {
        try {
            System.out.println("糖果机: " + machine.getLocation());
            System.out.println("当前糖果: " + machine.getCount() + "个");
            System.out.println("当前状态: " + machine.getState());
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

}